I'm looking for a way to get the current memory for a windows process (specifically doors.exe). The vba equivalent of the dxl script I'm looking for is:
Sub getDoorsMem()
Dim sApp As String: sApp = "doors.exe"
Dim oTask As Object
Dim dMem As Double
For Each oTask In GetObject("winmgmts:").ExecQuery("Select WorkingSetSize from Win32_Process Where Name = '" & sApp & "'")
dMem = oTask.WorkingSetSize
Debug.Print dMem / 1024 / 1024 & "MB"
Next
End Sub
I was also thinking it cold be done with WSHshell. tlhIngan - Wed Jun 25 17:51:44 EDT 2014 |
Re: Windows Process Memory Hi First you should be aware, that doors itself does only perform a relative small part of ole Support. In VBA you know GetObject and CreateObject. I do not understand why you start with GetObject, but ok. You think, that this object allready exists. Then you start OleObject objWmi = oleGetAutoObject("winmgmts:"): Otherwise you should use oleCreateAutoObject. Both routines are not an exact dxl replication of GetObject and CreateObject. The you have the objWmi. To run the routine "ExecQuery" you shall use oleMethod. The for each loop, you can forget. In this case you have to read the "count" property with oleGet and so on. Best regards Wolfgang
|
Re: Windows Process Memory
You may want to take a look at the following thread: |
Re: Windows Process Memory SudarshanRao - Thu Jun 26 04:19:21 EDT 2014
You may want to take a look at the following thread: Hell Sudarshan This are different problems. The WMI can only help in the management outside of doorsThat means: Here you can manage the total ressources you need to manage doors. It is something more specifc as the information you simply get from the taskmanager, but this is it. The link you have posted, dicusses the doors internal situation. For example each dxl-script of its own gets his specific subset of ressources. And then you can get a crash in different ways. For example you can create strings as much as possible until doors crashes. That does not mean, that you cannot terminate the script after doing 80% of its job and start a new script which opens modules and so on. There are different sets off ressources and so there are different reasons for a crash. If you want to geht some info about the ressources, which are allready used by all different tasks and jobs, you have to get into the undocumented doors underworld. If have had a script, that crashes at a specific point and getMemoryUsage could not help me in any way. Best regards Wolfgang
|
Re: Windows Process Memory SudarshanRao - Thu Jun 26 04:19:21 EDT 2014
You may want to take a look at the following thread: I got what I needed with the help of SudarhanRao's post. Although getMemoryUsage() appears to return the value in MB not KB. I don't understand exacly what getMemoryUsage() returns. It does not exactly match the task manager but seems to be close enough for a rough idea. It tended to report a lower number than task manager. I would guess 10 to 15 percent less. I plan to investigate WolfgangUhr idea at a later date. Thanks for the tips. |